"use strict";

/** @type {import('sequelize-cli').Migration} */
module.exports = {
  async up(queryInterface, Sequelize) {
    /**
     * Add altering commands here.
     *
     * Example:
     * await queryInterface.createTable('users', { id: Sequelize.INTEGER });
     */
    // 删除字段
    await queryInterface.removeColumn("products", "price");
    await queryInterface.removeColumn("products", "cost_price");
    await queryInterface.removeColumn("products", "original_price");
    await queryInterface.removeColumn("products", "stock");
    await queryInterface.removeColumn("products", "sales");
    await queryInterface.removeColumn("products", "weight");
    await queryInterface.removeColumn("products", "volume");
    await queryInterface.removeColumn("products", "unit");
    await queryInterface.addColumn("products", "specs", {
      type: Sequelize.JSON,
      defaultValue: [],
    });
    await queryInterface.addColumn("products", "skus", {
      type: Sequelize.JSON,
      defaultValue: [],
    });
  },

  async down(queryInterface, Sequelize) {
    /**
     * Add reverting commands here.
     *
     * Example:
     * await queryInterface.dropTable('users');
     */
  },
};
